#!/bin/bash
#2021-10-15 1448

# redhat>6.9 centos>6.9 NeoKylin-Desktop Debian>8 Ubuntu>14.10 Linx80 UniKylin>2
new_os_array=(100101 100111 101141 100142 100201 100221 100301)
kylin_os_array=(100141 101141 100142)
# redhat<7.0  centos<7.0 NeoKylin-SERVER-6.5  Linx60
old_os_array=(100102 100112 100222)
# isContains "${systemd_os_array[*]}" "${OS_CODE}"
if [[ ${new_os_array[*]/${OS_CODE}/} != ${systemd_os_array[*]} ]];then
    setenforce 0
elif [[ ${old_os_array[*]/${OS_CODE}/} != ${service_os_array[*]} ]]; then
    echo 0 > /selinux/enforce
elif [[ ${kylin_os_array[*]/${OS_CODE}/} != ${systemd_os_array[*]} ]]; then
    sed -i "s:^SELINUX=.*$:SELINUX=disabled:g" /etc/selinux/config
else
    echo -e "\033[31m unrecognized this system \033[0m"
fi

sed -i "s:^SELINUX=.*$:SELINUX=disabled:g" /etc/sysconfig/selinux
sestatus